﻿# SongpingWang
#
cmake_minimum_required (VERSION 3.20)
set(APP test_opencv_learning)
project(${APP})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE "Release")


if (BUILD_SHARED_LIBS)
    add_definitions(-DBUILD_SHARED_LIBS)
    if (CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
       add_definitions("-fPIC")
    endif()
    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()


option(ENABLE_WSP "SongpingWang's File dir default=TURE" ON)


if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)       # 设置了可执行文件的输出目录
    SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)               # 设置可执行文件的输出目录
    SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)                  # 设置库文件的输出目录
    if (EXISTS "/etc/redhat-release")
        message("redhat.")
    else()
        message("ubuntu.")
    endif()
else()
    message("windows platform.")
    if(ENABLE_WSP)
        message(STATUS "使用wsp的包含目录配置")
        set(OpenCV_DIR "E:/opencv452_cuda/install")
        set(OpenCV_LIB_DIR       ${OpenCV_DIR}/x64/vc16/lib)
        set(OpenCV_INCLUDE_DIRS  ${OpenCV_DIR}/include)
        set(OpenCV_INCLUDE_DIRS2  ${OpenCV_DIR}/include/opencv2)
        file(GLOB OpenCV_LIBS    ${OpenCV_LIB_DIR}/*.lib)
        message(STATUS "OpenCV:")
        message(STATUS "    头文件目录：${OpenCV_INCLUDE_DIRS}")
        message(STATUS "    头文件目录：${OpenCV_INCLUDE_DIRS2}")
        message(STATUS "    库文件目录：${OpenCV_LIB_DIR}")
        message(STATUS "    库文件列表：${OpenCV_LIBS}")
        include_directories(${OpenCV_INCLUDE_DIRS})
        include_directories(${OpenCV_INCLUDE_DIRS2})
        link_libraries("${OpenCV_LIB_DIR}/opencv_highgui452.lib")
        link_libraries("${OpenCV_LIB_DIR}/opencv_dnn452.lib")
        link_libraries("${OpenCV_LIB_DIR}/opencv_imgproc452.lib")
        link_libraries("${OpenCV_LIB_DIR}/opencv_core452.lib")
        link_libraries("${OpenCV_LIB_DIR}/opencv_imgcodecs452.lib")
        link_libraries("${OpenCV_LIB_DIR}/opencv_imgcodecs452.lib")
    else()
        message(STATUS "使用zjl的包含目录配置")
    endif()
    include_directories("./include")

    set(SOURCE_FILES
        src/PhotoShop_Algorithm.cpp
        src/Filter_Algorithm.cpp
        src/Image_color_optimization.cpp
    )
    add_executable (${APP} ${SOURCE_FILES} "test.cpp")
endif()